// (Financial application: calculate tips) Write a program that reads the subtotal 
// and the gratuity rate, then computes the gratuity and total. For example, if the 
// user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5
// as gratuity and $11.5 as total.

import java.util.Scanner;

public class test25 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        
        // 提示用户输入小计和小费率
        System.out.print("Enter the subtotal and gratuity rate (e.g., 10 15): ");
        double subtotal = input.nextDouble();
        double gratuityRate = input.nextDouble();
        
        // 计算小费和总金额
        double gratuity = subtotal * (gratuityRate / 100);
        double total = subtotal + gratuity;
        
        // 显示结果，保留适当的小数位数
        System.out.printf("Gratuity: $%.1f%n", gratuity);
        System.out.printf("Total: $%.1f%n", total);
        
        // 关闭Scanner
        input.close();
    }
}
